package com.yadong.demo01;


import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
public class Bean1 {

	private String name = "bean1";

	@Autowired
	Bean2 bean2;

	public Bean1(){

	}
	public Bean1(String name){
		this.name = name;
	}


	public Bean2 getBean2() {
		return bean2;
	}

	public void setBean2(Bean2 bean2) {
		this.bean2 = bean2;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	@Override
	public String toString() {
		return "Bean1{" +
				"name='" + name + '\'' +
				", bean2.name=" + bean2.getName() +
				'}';
	}
}
